Leadtools.Jpeg2000 Namespace > Jpeg2000Engine Class > ReadFrames Method : ReadFrames(RasterCodecs,Stream,List<Int32>,Int32,CodecsLoadByteOrder) Method |
Color order for 16-, 24-, 32-, 48-, and 64-bit images. If the resulting image is less than 16 bits per pixel, this will have no effect since palletized images do not use color order. Valid values are as follows:
Value | Meaning |
---|---|
CodecsLoadByteOrder.Rgb | Red, green, and blue color order in memory |
CodecsLoadByteOrder.Bgr | Blue, green, and red color order in memory |
CodecsLoadByteOrder.Gray | 12- or 16-bit grayscale image. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions. |
CodecsLoadByteOrder.RgbOrGray | Load the image as red, green, blue OR as a 12- or 16-bit grayscale image. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions. |
CodecsLoadByteOrder.BgrOrGray | Load the image as blue, green, red OR as a 12- or 16-bit grayscale image. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions. |
CodecsLoadByteOrder.Romm | ROMM order. ROMM only supports 24- and 48-bit images. |
CodecsLoadByteOrder.BgrOrGrayOrRomm | Load the image as red, green, blue OR as a 12- or 16-bit grayscale image OR as ROMM. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions. ROMM only supports 24- and 48-bit color images. |
public List<CompositeJpxImages> ReadFrames( RasterCodecs codecs, Stream stream, List<int> frames, int bitsPerPixel, CodecsLoadByteOrder order )
'Declaration Public Overloads Function ReadFrames( _ ByVal codecs As RasterCodecs, _ ByVal stream As Stream, _ ByVal frames As List(Of Integer), _ ByVal bitsPerPixel As Integer, _ ByVal order As CodecsLoadByteOrder _ ) As List(Of CompositeJpxImages)
'Usage Dim instance As Jpeg2000Engine Dim codecs As RasterCodecs Dim stream As Stream Dim frames As List(Of Integer) Dim bitsPerPixel As Integer Dim order As CodecsLoadByteOrder Dim value As List(Of CompositeJpxImages) value = instance.ReadFrames(codecs, stream, frames, bitsPerPixel, order)
public List<CompositeJpxImages> ReadFrames( RasterCodecs codecs, Stream stream, List<int> frames, int bitsPerPixel, CodecsLoadByteOrder order )
function Leadtools.Jpeg2000.Jpeg2000Engine.ReadFrames(RasterCodecs,Stream,List{Int32},Int32,CodecsLoadByteOrder)( codecs , stream , frames , bitsPerPixel , order )
public: List<CompositeJpxImages^>^ ReadFrames( RasterCodecs^ codecs, Stream^ stream, List<int>^ frames, int bitsPerPixel, CodecsLoadByteOrder order )
Color order for 16-, 24-, 32-, 48-, and 64-bit images. If the resulting image is less than 16 bits per pixel, this will have no effect since palletized images do not use color order. Valid values are as follows:
Value | Meaning |
---|---|
CodecsLoadByteOrder.Rgb | Red, green, and blue color order in memory |
CodecsLoadByteOrder.Bgr | Blue, green, and red color order in memory |
CodecsLoadByteOrder.Gray | 12- or 16-bit grayscale image. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions. |
CodecsLoadByteOrder.RgbOrGray | Load the image as red, green, blue OR as a 12- or 16-bit grayscale image. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions. |
CodecsLoadByteOrder.BgrOrGray | Load the image as blue, green, red OR as a 12- or 16-bit grayscale image. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions. |
CodecsLoadByteOrder.Romm | ROMM order. ROMM only supports 24- and 48-bit images. |
CodecsLoadByteOrder.BgrOrGrayOrRomm | Load the image as red, green, blue OR as a 12- or 16-bit grayscale image OR as ROMM. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions. ROMM only supports 24- and 48-bit color images. |
Public Sub ReadFramesStreamExample() Dim fs As FileStream = File.OpenRead(Path.Combine(LEAD_VARS.ImagesDir, "image1.jpx")) ' Load a JPEG 2000 image Dim engine As New Jpeg2000Engine() Dim fileInfo As Jpeg2000FileInformation = engine.GetFileInformation(fs) If (fileInfo.Frame.GetLength(0) < 2) Then Return End If Dim codecs As New RasterCodecs() codecs.ThrowExceptionsOnInvalidImages = True Dim frames As New List(Of Integer) frames.Add(1) Dim images As List(Of CompositeJpxImages) = engine.ReadFrames(codecs, fs, frames, 0, CodecsLoadByteOrder.BgrOrGray) ' Clean up fs.Close() Dim _image As CompositeJpxImages For Each _image In images _image.ColorImage.Dispose() _image.OpacityImage.Dispose() _image.PreOpacityImage.Dispose() Next _image codecs.Dispose() End Sub Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
public void ReadFramesStreamExample() { FileStream fs = File.OpenRead(Path.Combine(LEAD_VARS.ImagesDir, "image1.jpx")); // Load a JPEG 2000 image Jpeg2000Engine engine = new Jpeg2000Engine(); Jpeg2000FileInformation fileInfo = engine.GetFileInformation(fs); if (fileInfo.Frame.GetLength(0) < 2) return; RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; List<int> frames = new List<int>(); frames.Add(1); List<CompositeJpxImages> images = engine.ReadFrames(codecs, fs, frames, 0, CodecsLoadByteOrder.BgrOrGray); // Clean up fs.Close(); foreach (CompositeJpxImages image in images) { if (image.ColorImage != null) image.ColorImage.Dispose(); if (image.OpacityImage != null) image.OpacityImage.Dispose(); if (image.PreOpacityImage != null) image.PreOpacityImage.Dispose(); } codecs.Dispose(); } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
Jpeg2000Engine Class
Jpeg2000Engine Members
Overload List
AppendFrames
Load
LoadComposite
ReadFrames(RasterCodecs,String, List, Int32, CodecsLoadByteOrder)
Save
SaveComposite
Compression Using LEAD and JPEG Formats
File Formats - JPEG And LEAD Compressed
Bitmaps In Memory And In Files
JPEG2000 File Comments
JPEG And LEAD File Comments
Programming with JPEG 2000 Features
JPEG 2000 Boxes